﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.Interfaces;

namespace Core.Domains
{

    class OwnedBuilding : IOwnedBuilding, INalog
    {
        private bool _fromDatabase;
        private IBuilding _building;
        private ICustomer _customer;
        private DateTime _date;
        private int _endPrice;
        private string _fio;
        private IAction _action;

        public bool FromDatabase()
        {
            return _fromDatabase;
        }

        public string GetErrorByCode(int code)
        {
            throw new NotImplementedException();
        }

        public IBuilding Building
        {
            get { return _building; }
            set { _building = value; }
        }

        public IAction Action
        {
            get { return _action; }
            set { _action = value; }
        }

        public ICustomer Customer
        {
            get { return _customer; }
            set { _customer = value; }
        }

        public DateTime DayOfBuy
        {
            get { return _date; }
            set { _date = value; }
        }

        public int EndPrice
        {
            get { return _endPrice; }
            set { _endPrice = value; }
        }

        public string Fio
        {
            get { return ""; }
            set { _fio = value; }
        }

        public string RegId
        {
            get { return _building.RegisterID; }
        }

        public void ConstructIt(object[] Record)
        {
            _date = DateTime.Parse(Record[3].ToString());
            _endPrice = int.Parse(Record[4].ToString());
            _fromDatabase = true;
        }

        #region Implementation of INalog

        public int Nalog
        {
            get { return 0; }
            set{}
        }

        #endregion
    }
}
